/*
 * Selling Partner API for Easy Ship
 *
 * Use the Selling Partner API for Easy Ship to build applications for sellers to manage and ship Amazon Easy Ship orders. With this API, you can get available time slots, schedule and reschedule Easy Ship orders, and print shipping labels, invoices, and warranties. To review the differences in Easy Ship operations by marketplace, refer to [Marketplace support](https://developer-docs.amazon.com/sp-api/docs/easyship-api-v2022-03-23-use-case-guide#marketplace-support).
 *
 * The version of the OpenAPI document: 2022-03-23
 * Generated by: https://github.com/openapitools/openapi-generator.git
 */


using System;
using System.Collections;
using System.Collections.Generic;
using System.Collections.ObjectModel;
using System.Linq;
using System.IO;
using System.Runtime.Serialization;
using System.Text;
using System.Text.RegularExpressions;
using Newtonsoft.Json;
using Newtonsoft.Json.Converters;
using Newtonsoft.Json.Linq;
using System.ComponentModel.DataAnnotations;
using OpenAPIDateConverter = software.amzn.spapi.Client.OpenAPIDateConverter;

namespace software.amzn.spapi.Model.easyship.v2022_03_23
{
    /// <summary>
    /// The dimensions of the scheduled package.
    /// </summary>
    [DataContract(Name = "Dimensions")]
    public partial class Dimensions : IValidatableObject
    {

        /// <summary>
        /// Gets or Sets Unit
        /// </summary>
        [DataMember(Name = "unit", EmitDefaultValue = false)]
        public UnitOfLength? Unit { get; set; }
        /// <summary>
        /// Initializes a new instance of the <see cref="Dimensions" /> class.
        /// </summary>
        /// <param name="length">The numerical value of the specified dimension..</param>
        /// <param name="width">The numerical value of the specified dimension..</param>
        /// <param name="height">The numerical value of the specified dimension..</param>
        /// <param name="unit">unit.</param>
        /// <param name="identifier">A string of up to 255 characters..</param>
        public Dimensions(float length = default(float), float width = default(float), float height = default(float), UnitOfLength? unit = default(UnitOfLength?), string identifier = default(string))
        {
            this.Length = length;
            this.Width = width;
            this.Height = height;
            this.Unit = unit;
            this.Identifier = identifier;
        }

        /// <summary>
        /// The numerical value of the specified dimension.
        /// </summary>
        /// <value>The numerical value of the specified dimension.</value>
        [DataMember(Name = "length", EmitDefaultValue = false)]
        public float Length { get; set; }

        /// <summary>
        /// The numerical value of the specified dimension.
        /// </summary>
        /// <value>The numerical value of the specified dimension.</value>
        [DataMember(Name = "width", EmitDefaultValue = false)]
        public float Width { get; set; }

        /// <summary>
        /// The numerical value of the specified dimension.
        /// </summary>
        /// <value>The numerical value of the specified dimension.</value>
        [DataMember(Name = "height", EmitDefaultValue = false)]
        public float Height { get; set; }

        /// <summary>
        /// A string of up to 255 characters.
        /// </summary>
        /// <value>A string of up to 255 characters.</value>
        [DataMember(Name = "identifier", EmitDefaultValue = false)]
        public string Identifier { get; set; }

        /// <summary>
        /// Returns the string presentation of the object
        /// </summary>
        /// <returns>String presentation of the object</returns>
        public override string ToString()
        {
            StringBuilder sb = new StringBuilder();
            sb.Append("class Dimensions {\n");
            sb.Append("  Length: ").Append(Length).Append("\n");
            sb.Append("  Width: ").Append(Width).Append("\n");
            sb.Append("  Height: ").Append(Height).Append("\n");
            sb.Append("  Unit: ").Append(Unit).Append("\n");
            sb.Append("  Identifier: ").Append(Identifier).Append("\n");
            sb.Append("}\n");
            return sb.ToString();
        }

        /// <summary>
        /// Returns the JSON string presentation of the object
        /// </summary>
        /// <returns>JSON string presentation of the object</returns>
        public virtual string ToJson()
        {
            return Newtonsoft.Json.JsonConvert.SerializeObject(this, Newtonsoft.Json.Formatting.Indented);
        }

        /// <summary>
        /// To validate all properties of the instance
        /// </summary>
        /// <param name="validationContext">Validation context</param>
        /// <returns>Validation Result</returns>
        IEnumerable<ValidationResult> IValidatableObject.Validate(ValidationContext validationContext)
        {
            // Length (float) minimum
            if (this.Length < (float)0.01)
            {
                yield return new ValidationResult("Invalid value for Length, must be a value greater than or equal to 0.01.", new [] { "Length" });
            }

            // Width (float) minimum
            if (this.Width < (float)0.01)
            {
                yield return new ValidationResult("Invalid value for Width, must be a value greater than or equal to 0.01.", new [] { "Width" });
            }

            // Height (float) minimum
            if (this.Height < (float)0.01)
            {
                yield return new ValidationResult("Invalid value for Height, must be a value greater than or equal to 0.01.", new [] { "Height" });
            }

            // Identifier (string) maxLength
            if (this.Identifier != null && this.Identifier.Length > 255)
            {
                yield return new ValidationResult("Invalid value for Identifier, length must be less than 255.", new [] { "Identifier" });
            }

            // Identifier (string) minLength
            if (this.Identifier != null && this.Identifier.Length < 1)
            {
                yield return new ValidationResult("Invalid value for Identifier, length must be greater than 1.", new [] { "Identifier" });
            }

            yield break;
        }
    }

}
